const express = require('express');
const router = express.Router();
const { protect } = require('../middleware/auth');
const healthController = require('../controllers/healthController');

// 血糖相关路由
router.route('/glucose')
  .get(protect, healthController.getGlucoseRecords)
  .post(protect, healthController.addGlucoseRecord);

router.route('/glucose/stats')
  .get(protect, healthController.getGlucoseStats);

router.route('/glucose/:id')
  .get(protect, healthController.getGlucoseRecord)
  .put(protect, healthController.updateGlucoseRecord)
  .delete(protect, healthController.deleteGlucoseRecord);

// 血压相关路由
router.route('/blood-pressure')
  .get(protect, healthController.getBloodPressureRecords)
  .post(protect, healthController.addBloodPressureRecord);

router.route('/blood-pressure/:id')
  .get(protect, healthController.getBloodPressureRecord)
  .put(protect, healthController.updateBloodPressureRecord)
  .delete(protect, healthController.deleteBloodPressureRecord);

// 体重相关路由
router.route('/weight')
  .get(protect, healthController.getWeightRecords)
  .post(protect, healthController.addWeightRecord);

router.route('/weight/:id')
  .get(protect, healthController.getWeightRecord)
  .put(protect, healthController.updateWeightRecord)
  .delete(protect, healthController.deleteWeightRecord);

// 风险评估相关路由
router.route('/risk-assessment')
  .get(protect, healthController.getRiskAssessments)
  .post(protect, healthController.addRiskAssessment);

router.route('/risk-assessment/stats')
  .get(protect, healthController.getRiskAssessmentStats);

router.route('/risk-assessment/:id')
  .get(protect, healthController.getRiskAssessment)
  .delete(protect, healthController.deleteRiskAssessment);

module.exports = router; 